package mason.dp.abstractfactory.computer;

import mason.dp.abstractfactory.Component.Battery;
import mason.dp.abstractfactory.Component.CPU;
import mason.dp.abstractfactory.Component.RAM;

/**
 * 计算机的抽象基类
 * 
 * @author MasonAir
 *
 */
public abstract class Computer {
	String name;
	CPU cpu;
	RAM ram;
	Battery battery;

	public abstract void prepare();

	public void printComputerInfo() {
		System.out.println("--------ComputerInFo start------------");
		System.out.println("名称：" + getName());
		System.out.println("Cpu：" + cpu.getName());
		System.out.println("----主频：" + cpu.getFrequency());
		System.out.println("----接口：" + cpu.getSocket());
		System.out.println("内存：" + ram.getName());
		System.out.println("----容量：" + ram.getSize());
		if (battery != null) {
			System.out.println("电池：" + battery.getName());
			System.out.println("----容量：" + battery.getSize());
		}
		System.out.println("--------ComputerInFo end--------------");
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
